﻿<?php
include_once "../funciones.php";
$con = conectar();
try {
	$con -> beginTransaction();
	$sql = "UPDATE CENTROS SET NOMBRE = '".$_REQUEST['NOMBRE']."', 
				PROVINCIA = ".$_REQUEST['PROVINCIA'].", 
				POBLACION = '".$_REQUEST['POBLACION']."', 
				DIRECCION = '".$_REQUEST['DIRECCION']."', 
				TELEFONO =  ".$_REQUEST['TELEFONO'].", 
				EMAIL =     '".$_REQUEST['EMAIL'] . "', 
				CIF =       '".$_REQUEST['CIF'] . "' 
				WHERE OID_CEN = " . $_REQUEST['OID_CEN'];
	
	echo $sql;
	$stmt = $con -> prepare($sql);
	$stmt -> execute();
	$stmt = $con -> prepare("commit");
	$stmt -> execute();
} catch(PDOException $e ) {
	echo "error: " . $e -> GetMessage();
	$con -> rollBack();
	header('Location: modificar.php?exito=2&oid=' . $_REQUEST['OID_CEN']);
}

header('Location: modificar.php?exito=1&oid=' . $_REQUEST['OID_CEN']);
?>